package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.InfoLog;
import com.woniuxy.mapper.InfoLogMapper;
import com.woniuxy.service.IInfoLogService;
import com.woniuxy.service.SaasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author：xurice
 * @date：Created in 2024/3/2 9:58
 * @description：
 * @modified By：
 * @version: $
 */
@Service
public class InfoLogServiceImpl implements IInfoLogService, SaasService {
    @Autowired
    InfoLogMapper infoLogMapper;
    @Override
    public Integer add(InfoLog infoLog) {
        return infoLogMapper.add(infoLog);
    }

    @Override
    public List<InfoLog> queryList(String username, Date beginTime, Date endTime) {
        return infoLogMapper.queryList(username,beginTime,endTime);
    }

    @Override
    public PageInfo<InfoLog> getPageInfo(Integer pageNum, Integer pageSize, String username, Date beginTime, Date endTime) {
        PageHelper.startPage(pageNum,pageSize);
        List<InfoLog> infoLogs = infoLogMapper.queryList(username, beginTime, endTime);
        PageInfo<InfoLog> pageInfo = new PageInfo<>(infoLogs);
        return pageInfo;
    }
}
